<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: imon
  Date: 2/17/13
  Time: 4:56 PM
-->
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions">

<h:head>
    <title>#{msg['index.title']}</title>
    <h:outputStylesheet library="css" name="style.css" />
</h:head>

<body class="main-container">

<p:layout id="layout" fullPage="true">

    <p:layoutUnit id="north" position="north" size="140" resizable="false">

        <div>
            <div class="container-left">
                <h1>FundRaiser</h1>
            </div>

            <div class="container-right">
                <h:form id="loginForm">

                    <p:outputLabel for="emailLogin" value="#{msg['index.email']}"/>
                    <p:spacer width="10px"/>
                    <p:inputText id="emailLogin" size="26" value="#{credentials.email}"/>
                    <p:spacer width="10px"/>
                    <p:outputLabel for="passwordLogin" value="#{msg['index.password']}"/>
                    <p:spacer width="10px"/>
                    <p:password id="passwordLogin" size="26" value="#{credentials.password}"/>
                    <p:spacer width="10px"/>
                    <p:commandButton id="login" action="#{loginController.logIn}" value="#{msg['index.login']}"/>
                </h:form>

                <div class="div-right">
                    <h:link outcome="forgotpassword.xhtml" value="#{msg['index.forgotPassword']}" />
                </div>


            </div>

        </div>


    </p:layoutUnit>


    <p:layoutUnit id="center" position="center">

        <h:form id="searchForm">
            <div class="center-div">

                <p:outputLabel value="#{msg['index.searchIssue']}"/>
                <p:spacer width="10px"/>
                <h:inputText id="search" size="40" value="#{indexController.searchKeyword}"/>
                <p:watermark for="search" value="#{msg['index.waterMark']}"/>
                <p:spacer width="10px"/>
                <p:commandButton ajax="true" update="dataList" value="#{msg['index.search']}" actionListener="#{indexController.searchIssue}"/>

            </div>
            <p:separator/>
            <p:spacer/>


            <c:choose>
                <c:when test="${not empty indexController.issueList}">
                    <p:dataList id="dataList" value="#{indexController.issueList}" var="issueList"
                                paginator="true" rows="3" effectSpeed="fast"
                                paginatorTemplate="{PreviousPageLink} {CurrentPageReport} {NextPageLink} {RowsPerPageDropdown}"
                                rowsPerPageTemplate="3,5,10" type="none">

                        <div style="padding-left: 5px; padding-right: 5px">

                            <f:facet name="header">
                                #{msg['index.facet']}
                            </f:facet>

                            <div>

                                <h:commandLink target="_blank" style="color: #6495ed;font-size: 24px"
                                               value="#{issueList.title}"
                                               action="#{indexController.donate}" />

                            </div>
                            <p:spacer/>
                            <h:panelGrid columns="2">

                                <h:outputLabel value="#{msg['index.helpFor']} "/>
                                <h:outputText value="#{issueList.helpFor}"/>
                                <h:outputLabel value="#{msg['index.description']} "/>
                                <h:outputText escape="false" value="#{issueList.description}"/>
                                <h:outputLabel value="#{msg['index.creationDate']} "/>
                                <h:outputText value="#{issueList.createdDate}"/>
                                <h:outputLabel value="#{msg['index.collectedAmount']} "/>
                                <h:outputText value="#{issueList.collectedAmount}"/>
                                <h:outputLabel value="#{msg['index.requiredAmount']}"/>
                                <h:outputText value="#{issueList.requiredAmount}"/>

                            </h:panelGrid>
                            <p:separator/>
                        </div>
                    </p:dataList>
                </c:when>
                <c:otherwise>
                    <p:panel>
                        <f:facet name="header">
                            #{msg['index.facet']}
                        </f:facet>
                        <p:outputLabel>
                            #{msg['index.noIssueFound']}
                        </p:outputLabel>
                    </p:panel>
                </c:otherwise>
            </c:choose>
        </h:form>

    </p:layoutUnit>


    <p:layoutUnit position="south" size="130" resizable="false">
        <div>
            <div class="container-left-footer">
                <p:outputLabel value="#{msg['footer.left']}"/>
            </div>
            <div class="container-right-footer">
                <p:outputLabel value="#{msg['footer.right']}"/>
            </div>
        </div>
    </p:layoutUnit>

    <p:layoutUnit position="east" size="450" resizable="false">
        <div class="signup-container">
            <h1>#{msg['index.signUp']}</h1>

            <h:form id="form">
                <p:messages id="messages" autoUpdate="true"/>
                <h:panelGrid id="grid" columns="2">
                    <p:outputLabel for="name" value="#{msg['index.name']}"/>
                    <p:inputText id="name" required="true" requiredMessage="#{msg['index.name.requiredMsg']}" size="26"
                                 value="#{signUpController.user.userName}"/>

                    <p:outputLabel for="email" value="#{msg['index.email']}"/>
                    <p:inputText id="email" required="true" requiredMessage="#{msg['index.email.requiredMsg']}" size="26"
                                 value="#{signUpController.user.email}"/>

                    <p:outputLabel for="password1" value="#{msg['index.password']}"/>
                    <p:password id="password1" match="password2" feedback="true" required="true"
                                requiredMessage="#{msg['index.password.requiredMsg']}" size="26"
                                value="#{signUpController.user.password}"/>

                    <p:outputLabel for="password2" value="#{msg['index.confirmPassword']}"/>
                    <p:password id="password2" required="true" requiredMessage="#{msg['index.confirmPassword.requiredMsg']}" size="26"
                                value="#{signUpController.user.password}"/>

                    <p:outputLabel for="nationalId" value="#{msg['index.nationalId']}"/>
                    <p:inputText id="nationalId" required="true" requiredMessage="#{msg['index.nationalId.requiredMsg']}" size="26"
                                 value="#{signUpController.user.nationalId}"/>

                    <p:outputLabel for="presentAddress" value="#{msg['index.presentAddress']}"/>
                    <p:inputTextarea id="presentAddress" required="true" requiredMessage="#{msg['index.presentAddress.requiredMsg']}"
                                     size="26" value="#{signUpController.user.presentAddress}"/>

                    <p:outputLabel for="permanentAddress" value="#{msg['index.permanentAddress']}"/>
                    <p:inputTextarea id="permanentAddress" required="true"
                                     requiredMessage="#{msg['index.permanentAddress.requiredMsg']}" size="26"
                                     value="#{signUpController.user.permanentAddress}"/>

                    <p:outputLabel for="contactNo" value="#{msg['index.contactNo']}"/>
                    <p:inputText id="contactNo" required="true" requiredMessage="#{msg['index.contactNo.requiredMsg']}" size="26"
                                 value="#{signUpController.user.phoneNumber}"/>


                    <p:spacer/>
                    <p:commandButton action="#{signUpController.signUp()}" value="#{msg['index.signUp']}"/>
                </h:panelGrid>
            </h:form>
        </div>
    </p:layoutUnit>
</p:layout>

</body>

</html>